package uk.ac.glasgow.demosocs.tests;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import uk.ac.glasgow.demosocs.VotingSystem;
import uk.ac.glasgow.demosocs.impl.VotingSystemStub;

public class GetElections {

	private VotingSystem testVS;
	
	@Before
	public void setUp() throws Exception {
		testVS = new VotingSystemStub();
	}

	@After
	public void tearDown() throws Exception {
		testVS = null;
	}

	@Test
	/** 
	 * test number of elections in the getElections set has 
	 * increased by the correct amount after creation of new elections
	 */
	public void test() {
		int sfirst = testVS.getElections().size();
		testVS.setCurrentUser("admin", "p");
		testVS.createElection("e1", "Simple_Plurality");
		testVS.createElection("e2", "Simple_Plurality");
		testVS.createElection("e3", "Simple_Plurality");
		
		int s = testVS.getElections().size();
		assertEquals(3, s-sfirst);
	}

}